/*  1:   */ package com.rinsi.util;
/*  2:   */ 
/*  3:   */ import java.io.IOException;
/*  4:   */ import java.util.Enumeration;
/*  5:   */ import java.util.HashMap;
/*  6:   */ import java.util.Map;
/*  7:   */ import java.util.Properties;
/*  8:   */ 
/*  9:   */ public class ConfigUtil
/* 10:   */ {
/* 11:   */   public static Map<String, Object> config()
/* 12:   */   {
/* 13:27 */     return config("config.properties");
/* 14:   */   }
/* 15:   */   
/* 16:   */   public static Map<String, Object> config(String name)
/* 17:   */   {
/* 18:32 */     Map<String, Object> map = new HashMap();
/* 19:   */     try
/* 20:   */     {
/* 21:36 */       Properties prop = new Properties();
/* 22:   */       
/* 23:38 */       prop.load(ConfigUtil.class.getClassLoader().getResourceAsStream(name));
/* 24:   */       
/* 25:40 */       Enumeration<Object> e = prop.keys();
/* 26:42 */       while (e.hasMoreElements())
/* 27:   */       {
/* 28:44 */         String key = (String)e.nextElement();
/* 29:   */         
/* 30:46 */         map.put(key, prop.getProperty(key));
/* 31:   */       }
/* 32:   */     }
/* 33:   */     catch (IOException e)
/* 34:   */     {
/* 35:51 */       e.printStackTrace();
/* 36:   */     }
/* 37:54 */     return map;
/* 38:   */   }
/* 39:   */   
/* 40:   */   public static Map<String, Object> config(Class<?> clazz)
/* 41:   */   {
/* 42:64 */     return config(clazz, "config.properties");
/* 43:   */   }
/* 44:   */   
/* 45:   */   public static Map<String, Object> config(Class<?> clazz, String name)
/* 46:   */   {
/* 47:74 */     Map<String, Object> map = new HashMap();
/* 48:   */     try
/* 49:   */     {
/* 50:78 */       Properties prop = new Properties();
/* 51:   */       
/* 52:80 */       prop.load(clazz.getResourceAsStream("config.properties"));
/* 53:   */       
/* 54:82 */       Enumeration<Object> e = prop.keys();
/* 55:84 */       while (e.hasMoreElements())
/* 56:   */       {
/* 57:86 */         String key = (String)e.nextElement();
/* 58:   */         
/* 59:88 */         map.put(key, new String(prop.getProperty(key).getBytes("ISO8859-1"), "UTF-8"));
/* 60:   */       }
/* 61:   */     }
/* 62:   */     catch (IOException e)
/* 63:   */     {
/* 64:93 */       e.printStackTrace();
/* 65:   */     }
/* 66:96 */     return map;
/* 67:   */   }
/* 68:   */ }


/* Location:           D:\Users\Desktop\shanxi\项目\sxazmis\WEB-INF\classes\
 * Qualified Name:     com.rinsi.util.ConfigUtil
 * JD-Core Version:    0.7.0.1
 */